import {
	createStore
} from 'vuex'

export default createStore({
	state: () => { // 状态
		// state推荐写成函数返回组件的形式
		return {
			order: '',
			addressId: '',
			login: false,
			userinfo: ''
		}
	},
	getters: { // 计算

	},
	mutations: { // 同步更新
		updateOrder(state, payload) {
			state.order = payload
			console.log(state.order)
		},
		updateAddressId(state, payload) {
			state.addressId = payload
		},
		uploadLogin(state, payload) {
			state.login = payload
		},
		uploadUserinfo(state, payload) {
			state.userinfo = payload
		}
	},
	actions: { // 异步更新

	}
})